package com.yc.backstage.controller;

import com.yc.backstage.service.SysConfigService;
import com.yc.common.res.ResultClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Classname SysConfigController
* @Description
* @Version 1.0.0
* @Date 2022-08-23 11:49:19
* @Created by Mikechen
*/
@RestController
@RequestMapping("/backstage/sysConfig")
public class SysConfigController {
    @Autowired
    private SysConfigService sysConfigService;
    /**
     * 根据参数键名查询参数值
     */
    @PreAuthorize("@el.hasRole('system:dict:query')")
    @GetMapping(value = "/configKey/{configKey}")
    public ResultClass getConfigKey(@PathVariable("configKey") String configKey) {
        return ResultClass.success(sysConfigService.selectConfigByKey(configKey));
    }
}
